<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let arr=[`赵云`, `黄忠`, `关羽`, `张飞`, `马超`, `刘备`, `曹操`,]
    let i = Math.floor(Math.random()*arr.length)
    console.log(i);
    // 在页面展示抽取的数据
    let name=arr[i]
    document.write( arr[i])
    // 在数组中把刚刚抽取的数据删除，避免重复抽取
    arr.splice(i,1)
    console.log(arr);
  </script>
</body>
</html>